<%@page import="accessor.DepartmentAccessor"%>
<%@page import="accessor.Department"%>
<%@page import="java.util.List"%>
<%@include file="header.jsp" %>
<%@include file="menubar/adminmenu.jsp" %>
<div class="break_line"></div>
<div class="break_line"></div>

<div id="content">
    <div id="title_content">LIST DEPARTMENT</div>
    <% if (request.getSession().getAttribute("mess_department") != "" && request.getSession().getAttribute("mess_department") != null) {%>
    <div class="affiche_erreur" style="width: 475px;margin-left: 8px;">
        <%
            out.println(request.getSession().getAttribute("mess_department"));
        %>
    </div>
    <%}%>
    <form method="POST" action="#" onsubmit="return go();">
        <%
            DepartmentAccessor departmentAccessor = new DepartmentAccessor();
            List<Department> departments = departmentAccessor.getAll();
        %>
        <table class="list" width="100%">
            <thead>
                <tr>
                    <th>DEPARTMENT ID</th>
                    <th>DEPARTMENT NAME</th>
                    <th align="center">Action</th>
                </tr>
            </thead>
            <tbody>
                <% for (Department department : departments) {%>
                <tr>
                    <td><%= department.getDepartmentID()%></td>
                    <td><%= department.getDepartmentName()%></td>
                    <td width="30px"><a href="update_department.jsp?departmentID=<%= department.getDepartmentID()%>"><img src="../assets/css/backend/images/modifier.png" alt="modifier"/></a></td>
                </tr>
                <% }%>

            </tbody>
        </table>
        <div class="delete_button">
            <table width="100%">
                <tr>
                    <td align="left" width="200px" ></td>
                    <td align="right"></td>
                </tr>
            </table>
        </div>
    </form>
</div>
<!--END content-->
<%@include file="footer.jsp" %>